namespace Defiant.SqlServer.PowerShellScriptTask
{
    using System.Collections.Generic;
    using Microsoft.SqlServer.Dts.Runtime;

    public class SSISHelper
    {
        IDTSComponentEvents componentEvents;

        internal SSISHelper(IDTSComponentEvents componentEvents)
        {
            this.componentEvents = componentEvents;
        }

        #region Logging

        public void LogError(int code, string message)
        {
            this.componentEvents.FireError(code, Constants.COMPONENT, message, string.Empty, 0);
        }

        public void LogWarning(int code, string message)
        {
            this.componentEvents.FireWarning(code, Constants.COMPONENT, message, string.Empty, 0);
        }

        public void LogInformation(int code, string message)
        {
            bool fireAgain = true;
            this.componentEvents.FireInformation(code, Constants.COMPONENT, message, string.Empty, 0, ref fireAgain);
        }

        #endregion
    }
}
